package top.xiangqifu.fruit.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.xiangqifu.fruit.base.BasePageResult;
import top.xiangqifu.fruit.base.BaseResult;
import top.xiangqifu.fruit.entity.PageBean;
import top.xiangqifu.fruit.entity.TbFruit;
import top.xiangqifu.fruit.service.FruitService;

import java.util.List;



@RequestMapping("/fruit")
@RestController
public class ResuitController {
    @Autowired
    private FruitService fruitService;

    @PostMapping("/add")
    public BaseResult add(@RequestBody TbFruit tbFruit){
        return fruitService.add(tbFruit);
    }


    @PostMapping("/query")
    public BasePageResult<List<TbFruit>> query(@RequestBody TbFruit tbFruit, PageBean pageBean){
        return fruitService.query(tbFruit, pageBean);
    }


    @PostMapping("/update")
    public BaseResult update(@RequestBody TbFruit tbFruit){
        return fruitService.update(tbFruit);
    }


    @PostMapping("/delete")
    public BaseResult delete(@RequestBody TbFruit tbFruit){
        return fruitService.delete(tbFruit);
    }
}
